package com.web.controller;

import com.common.entity.User;
import com.common.vo.PageResult;
import com.common.vo.Result;
import com.web.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
@RequestMapping("/user")
public class UserController {
    @Autowired
    UserService userService;

    //用户信息查询
    @GetMapping("/query")
    public Result<PageResult> query(@RequestParam String email,
                              @RequestParam String twitter_username,
                              @RequestParam String company,
                              @RequestParam(value = "page", required = false, defaultValue = "1") int page,
                              @RequestParam(value = "size", required = false, defaultValue = "5") int size) {

        PageResult user = userService.getUser(email, twitter_username, company, page, size);

        return Result.success(user);
    }
}
